﻿using CoachingOrganizer.Logic.Models.Tools.MoneyCalculation;
using CoachingOrganizer.WinPhone.UITools;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace CoachingOrganizer.WinPhone.ViewModels.Tools.MoneyCalculation
{
    public class MoneyCalculationViewModel : ToolViewModelBase
    {
        private readonly MoneyCalculationModel _model;
        private readonly MoneyFlowViewModel _incomes;
        private readonly MoneyFlowViewModel _spents;
        private readonly ReportViewModel _report;
        
        public DateTime StartDate
        {
            get { return _model.StartDate; }
            set { _model.StartDate = value; }
        }

        public DateTime FinishDate
        {
            get { return _model.FinishDate; }
            set { _model.FinishDate = value; }
        }

        public MoneyFlowViewModel Incomes
        {
            get { return _incomes; }
        } 

        public MoneyFlowViewModel Spents
        {
            get { return _spents; }
        } 

        public ReportViewModel Report
        {
            get { return _report; }
        } 
        
        public ICommand GoDetailsCommand
        {
            get { return GetCommand(() => GoDetailsCommand, () => UIHelper.GoToPage(this, typeof(CoachingOrganizer.WinPhone.Pages.Tools.MoneyCalculation.MoneyCalculationPage))); }
        }

        public MoneyCalculationViewModel(MoneyCalculationModel model)
            : base(model)
        {
            _model = model;
            _incomes = new MoneyFlowViewModel(model.Incomes);
            _spents = new MoneyFlowViewModel(model.Spents);
        }
    }
}
